package com.neutech.service.impl;
import com.neutech.mapper.MenuMapper;
import com.neutech.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper menuMapper;
    @Override
    public List<Map<String, Object>> queryMenu() {
        List<Map<String, Object>> list = menuMapper.queryMenuList(0);
        for(Map<String, Object> map : list){
            Integer id = (Integer) map.get("id");
            List<Map<String, Object>> subList = menuMapper.queryMenuList(id);
            map.put("submenu",subList);
        }
        return list;
    }
}
